<?php
echo $this->Html->script('ckeditor/ckeditor');
?>
<section class="content-header">
    <h1>
        Cấu hình
    </h1>
    <ol class="breadcrumb">
        <li><a href="<?php echo DOMAINAD ?>" ><i class="fa fa-dashboard"></i> Trang chủ</a></li>
        <li><a href="<?php echo DOMAINAD ?>setting" > Cấu hình</a></li>
    </ol>
</section>
<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box-header">
                <div class="box-tools">
                    <div class="input-group">
                        <div class="input-group-btn">
                            <a href="#messages" rel="modal" class="btn btn-sm btn-warning" > Trợ giúp </a>
                            <a href="<?php echo DOMAINAD; ?>home" class="btn btn-sm btn-danger" > Đóng </a>
                        </div>
                    </div>
                </div>
            </div><!-- /.box-header -->

            <div class="box">
                <!-- form start -->
                <?php echo $this->Form->create(null, array('url' => DOMAINAD . 'setting', 'type' => 'post', 'enctype' => 'multipart/form-data', 'name' => 'image')); ?>
                <div class="box-body">
                    <?php
                    $my_error1 = $this->Session->flash();
                    if(strlen($my_error1) > 45){ ?>
                        <div class="alert alert-warning alert-dismissable">
                            <i class="fa fa-warning"></i>
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <?php echo $my_error1; ?>
                        </div>
                    <?php } ?>

                    <div class="form-group">
                        <label for="SettingName">Tên công ty</label>
                        <?php echo $this->Form->input('Setting.name', array('label' => '', 'class' => 'form-control')); ?>
                        <input name="data[Setting][id]" type="hidden" id="data[Setting][id]" value="1">
                    </div>

                    <div class="form-group">
                        <label for="SettingTitle">Tiêu đề website</label>
                        <?php echo $this->Form->input('Setting.title', array('label' => '', 'class' => 'form-control')); ?>
                    </div>

                    <div class="form-group">
                        <label for="SettingAddress">Địa chỉ</label>
                        <br />
                        <?php
                        $CKEditor = new CKEditor();
                        $CKEditor->returnOutput = true;
                        $CKEditor->config['width'] = '98%';
                        $CKEditor->config['height'] = '300';
                        CKFinder::SetupCKEditor( $CKEditor ) ;

                        $initialValue = $this->data['Setting']['address'];
                        echo $CKEditor->editor("data[Setting][address]", $initialValue, "");
                        ?>
                    </div>

                    <div class="form-group">
                        <label for="SettingTelephone">Điện thoại</label>
                        <?php echo $this->Form->input('Setting.telephone', array('label' => '', 'class' => 'form-control')); ?>
                    </div>

                    <div class="form-group">
                        <label for="SettingHotline">Hotline</label>
                        <?php echo $this->Form->input('Setting.hotline', array('label' => '', 'class' => 'form-control')); ?>
                    </div>

                    <div class="form-group">
                        <label for="SettingEmail">Email</label>
                        <?php echo $this->Form->input('Setting.email', array('label' => '', 'class' => 'form-control')); ?>
                    </div>

                    <div class="form-group">
                        <label for="SettingUrl">Link website</label>
                        <?php echo $this->Form->input('Setting.url', array('label' => '', 'class' => 'form-control')); ?>
                    </div>

                    <div class="form-group">
                        <label for="SettingContactinfo">Footer</label>
                        <br />
                        <?php
                        $CKEditor = new CKEditor();
                        $CKEditor->returnOutput = true;
                        $CKEditor->basePath = DOMAINAD . "js/ckeditor";
                        $CKEditor->config['width'] = '98%';
                        $CKEditor->config['height'] = '300';

                        $initialValue = $this->data['Setting']['contactinfo'];
                        echo $CKEditor->editor("data[Setting][contactinfo]", $initialValue, "");
                        ?>
                    </div>
                </div><!-- /.box-body -->

                <div class="box-footer">
                    <a href="javascript:void(0);" onclick="javascript:document.image.submit();" class="btn btn-primary"> <span class="icon-32-save"></span> Lưu </a>
                    <a href="javascript:void(0);" class="btn btn-primary" onclick="javascript:document.image.reset();"> <span class="icon-32-refresh"> </span> Làm mới </a>
                    <a href="#messages" rel="modal" class="btn btn-primary"> <span class="icon-32-help"></span> Trợ giúp </a>
                    <a href="<?php echo DOMAINAD ?>product" class="btn btn-primary"> <span class="icon-32-cancel"></span> Hủy </a>
                </div>
                <?php echo $this->Form->end(); ?>
            </div>
        </div>
    </div>

</section><!-- /.content -->